package G3.Mod;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity implements OnClickListener {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        View fsconversBtn = findViewById(R.id.fsconversBtn);
        fsconversBtn.setOnClickListener(this);
        View data2sdBtn = findViewById(R.id.data2sdBtn);
        data2sdBtn.setOnClickListener(this);
        View app2sdBtn = findViewById(R.id.app2sdBtn);
        app2sdBtn.setOnClickListener(this);
        View ocBtn = findViewById(R.id.overclockBtn);
        ocBtn.setOnClickListener(this);        
        
        //we declare the retrieveFS here, this way the conversion part of the app can directly show the current fs
        retrieveFS fs = new retrieveFS();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        new MenuInflater(this).inflate(R.menu.menu, menu);
        return (super.onCreateOptionsMenu(menu));
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.aboutMenu:
                startActivity(new Intent(this, About.class));
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.fsconversBtn:
                Intent fsconversion = new Intent(this, fsconvers.class);
                startActivity(fsconversion);
                break;
            case R.id.data2sdBtn:
                Intent data2sd = new Intent(this, data2sd.class);
                startActivity(data2sd);
                break;
            case R.id.app2sdBtn:
                Intent app2sd = new Intent(this, app2sd.class);
                startActivity(app2sd);
                break;
            case R.id.overclockBtn:
                Intent overclock = new Intent(this, overclock.class);
                startActivity(overclock);
                break;
        }
    }
}
